import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { JqtCpInfoVO, JqtCpInfoForm, JqtCpInfoQuery } from '@/api/bus/jqtCpInfo/types';

/**
 * 查询企业信息列表
 * @param query
 * @returns {*}
 */

export const listJqtCpInfo = (query?: JqtCpInfoQuery): AxiosPromise<JqtCpInfoVO[]> => {
  return request({
    url: '/bus/jqtCpInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询企业信息详细
 * @param id
 */
export const getJqtCpInfo = (id: string | number): AxiosPromise<JqtCpInfoVO> => {
  return request({
    url: '/bus/jqtCpInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增企业信息
 * @param data
 */
export const addJqtCpInfo = (data: JqtCpInfoForm) => {
  return request({
    url: '/bus/jqtCpInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改企业信息
 * @param data
 */
export const updateJqtCpInfo = (data: JqtCpInfoForm) => {
  return request({
    url: '/bus/jqtCpInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除企业信息
 * @param id
 */
export const delJqtCpInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bus/jqtCpInfo/' + id,
    method: 'delete'
  });
};

/**
 * 修改企业信息
 * @param data
 */
export const editRemark = (data: JqtCpInfoForm) => {
  return request({
    url: '/bus/jqtCpInfo/editRemark',
    method: 'put',
    data: data
  });
};


/**
 * 获取企业微信二维码
 * @param id
 */
export const addCpInfoCode = (): AxiosPromise<string> => {
  return request({
    url: '/bus/jqtCpInfo/addCpInfoCode',
    method: 'post'
  });
};

/**
 * 查询我的企业信息列表
 * @param query
 * @returns {*}
 */

export const getMyCpInfo = (query?: JqtCpInfoQuery): AxiosPromise<JqtCpInfoVO[]> => {
  return request({
    url: '/bus/jqtCpInfo/getMyCpInfo',
    method: 'get',
    params: query
  });
};
